#include<iostream>
#include<stack>
int main()
{
	stack<int> sta;
	int n,m;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>m;
		sta.push<m>;
		
		
	}
	 
	cout<<sta.top;
	
	
	return 0;
}


 
